/*
 * MessagingFrame.cpp
 *
 *  Created on: Feb 2, 2012
 *      Author: erudhes
 */
#include "MessagingFrame.h"
#include "MessagingPanel.h"
#include "MainFrame.h"
#include "App.h"

BEGIN_EVENT_TABLE(MessagingFrame, wxFrame)
EVT_MENU(MainFrame::MESSAGING_FRAME_MENU_EXIT_ID, MessagingFrame::onMenuExitClicked)
END_EVENT_TABLE()

MessagingFrame::MessagingFrame(const wxString& title, long style): wxFrame(NULL, MainFrame::MAIN_FRAME_WIN_ID, title, wxDefaultPosition, wxDefaultSize, style),
																   mMessagingPanel(NULL)
{
	wxMenu* fileMenu = new wxMenu();
	wxMenuBar* menuBar = new wxMenuBar();

	// Build up the menu bar and the panel for the messaging window
	fileMenu->Append(MainFrame::MESSAGING_FRAME_MENU_EXIT_ID, wxT("Exit"));
	menuBar->Append(fileMenu, wxT("File"));
	this->SetMenuBar(menuBar);
	mMessagingPanel = new MessagingPanel(this);
	this->SetClientSize(MessagingPanel::WIDTH, MessagingPanel::HEIGHT);
	this->Center();
	this->Show(true);
}

void MessagingFrame::onMenuExitClicked(wxCommandEvent& menuEvent)
{
	wxGetApp().getMainFrame()->onMessageFrameClosed();
	this->Close(true);
}
